package com.sinopac.taglib;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;

public class ElFunctionUtil {
	public static String url(String srcUrl) {
		HttpServletRequest req = ServletActionContext.getRequest();
		String contextPath = req.getSession().getServletContext()
				.getContextPath();
		if(srcUrl.matches("/.+")){
			srcUrl = srcUrl.substring(1);
		}
		return String.format("%s/%s", contextPath, srcUrl);
	}
}
